{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import glob\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "cols_4 =  ['Date', 'Time', 'Min','Max','Wire_Resistance','R1','R2','R3','R4','No_Name']\n",
    "cols_8 =  ['Date', 'Time', 'Min','Max','Wire_Resistance','R1','R2','R3','R4','R5','R6','R7','R8','No_Name']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "############# DONE LOOPING################\n"
     ]
    }
   ],
   "source": [
    "counter1 = 0\n",
    "f4 = []\n",
    "for file in glob.glob('../Data/??4*'):\n",
    "    df = pd.read_csv(file,sep=';',names=cols_4,encoding=\"ISO-8859-1\")\n",
    "    df = df.drop('No_Name',axis=1)\n",
    "    df['Time_Stamp'] = df['Date'] + ' ' + df['Time']\n",
    "    df['Time_Stamp'] = pd.to_datetime(df['Time_Stamp'],format='%y-%m-%d %H:%M:%S',errors='ignore')\n",
    "    df.index = df['Time_Stamp']\n",
    "    df.drop(['Date','Time'],axis=1,inplace=True)\n",
    "    f4.append(df)\n",
    "print('############# DONE LOOPING################')   \n",
    "df_4 = pd.concat(f4)\n",
    "df_4 = df_4.reset_index(drop=True)\n",
    "df_4.to_csv('Relay_4.csv')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "############# DONE LOOPING################\n"
     ]
    }
   ],
   "source": [
    "counter2 = 0\n",
    "f8 = []\n",
    "for file in glob.glob('../Data/??8*'):\n",
    "    counter2 = counter2 + 1\n",
    "    df = pd.read_csv(file,sep=';',names=cols_8, encoding=\"ISO-8859-1\")\n",
    "    df = df.drop('No_Name',axis=1)\n",
    "    #print(counter2)\n",
    "    df['Time_Stamp'] = df['Date'] + ' ' + df['Time']\n",
    "    df['Time_Stamp'] = pd.to_datetime(df['Time_Stamp'],format='%y-%m-%d %H:%M:%S',errors='ignore')\n",
    "    df.index = df['Time_Stamp']\n",
    "    df.drop(['Date','Time'],axis=1)\n",
    "    f8.append(df)\n",
    "print('############# DONE LOOPING################')   \n",
    "df_8 = pd.concat(f8)\n",
    "df_8 = df_8.reset_index(drop=True)\n",
    "df_8.to_csv('Relay_8.csv')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  },
  "nav_menu": {},
  "toc": {
   "navigate_menu": true,
   "number_sections": true,
   "sideBar": true,
   "threshold": 6,
   "toc_cell": false,
   "toc_section_display": "block",
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
